/**
 * 
 */
package org.jim.core.packets.cs.user.command;

import org.jim.core.ImStatus;
import org.jim.core.Status;
import org.jim.core.packets.pub.consts.Command;
import org.jim.core.packets.RespBody;
import org.jim.core.packets.pub.pojo.JimUser;

/**
 * 版本: [1.0]
 * 功能说明: 
 * 作者: WChao 创建时间: 2017年9月12日 下午3:15:28
 */
public class LoginRespCmd extends RespBody {
	
	private static final long serialVersionUID = 1L;
	private String token;
	private JimUser user;

	public LoginRespCmd(){
		this.setCommand(Command.COMMAND_LOGIN_RESP);
	}

	public LoginRespCmd(Status status){
		this(status,null);
	}

	public LoginRespCmd(Status status , JimUser user){
		this(status, user, null);
	}

	public LoginRespCmd(Status status , JimUser user, String token){
		super(Command.COMMAND_LOGIN_RESP, status);
		this.user = user;
		this.token = token;
	}

	public JimUser getUser() {
		return user;
	}

	public void setUser(JimUser user) {
		this.user = user;
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	public static LoginRespCmd success(){
		return new LoginRespCmd(ImStatus.C10007);
	}

	public static LoginRespCmd failed(){
		return new LoginRespCmd(ImStatus.C10008);
	}

	public static LoginRespCmd failed(String msg){
		LoginRespCmd loginRespBody = new LoginRespCmd(ImStatus.C10008);
		loginRespBody.setMsg(msg);
		return loginRespBody;
	}
}
